<%#

This file is part of Diligence

Copyright 2011-2012 Three Crickets LLC.

The contents of this file are subject to the terms of the LGPL version 3.0:
http://www.gnu.org/copyleft/lesser.html

Alternatively, you can obtain a royalty free commercial license with less
limitations, transferable or non-transferable, directly from Three Crickets
at http://threecrickets.com/

%><%& '/site/header/' %>
<%
document.executeOnce('/diligence/service/authentication/')
document.executeOnce('/diligence/service/authentication/provider/open-id/')

var provider = Diligence.Authentication.getProviderBySlug(conversation)
if (provider) {
	switch (provider.handle(conversation)) {
		case 'usernameForm':
			var form = new Diligence.Authentication.OpenIdProviderForm({provider: provider, conversation: conversation})
			form.handle({conversation: conversation, document: document, mode: 'include'})
			break
		
		case 'invalidSession':
			print('OpenID provider gave us an invalid session')
			break
			
		case 'providerError':
			print('OpenID provider is not providing')
			break
			
		case 'loggedIn':
		case 'provider':
			break
	}
}
%>
<%& '/site/footer/' %>
